﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TrocaOleo.Controller;

namespace TrocaOleo.Viewer
{
    public partial class Frota : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnGravar_Click(object sender, EventArgs e)
        {
            if (txtkm.Text == "")
                txtkm.Text = "0";
            if (txtkmoleo.Text == "")
                txtkmoleo.Text = "0";
            if (txtidmotorista.Text == "")
                txtidmotorista.Text = "0";
            
            WsTrocaOleo wsFrota = new Controller.WsTrocaOleo();
            wsFrota.InserirFrota(txtplaca.Text, txtmodelo.Text, (txtaquisicao.Text == "" ? null : txtaquisicao.Text), Convert.ToDouble(txtkm.Text), (txtatukm.Text == "" ? null : txtatukm.Text), Convert.ToDouble(txtkmoleo.Text), (txtdttrocaoleo.Text == "" ? null : txtdttrocaoleo.Text), Convert.ToInt32(txtidmotorista.Text));
            
            
        }
        
    }
}